#!/bin/bash

# 如果报错 curses.h: No such file or directory 需要安装
# sudo apt-get install libncurses5-dev libncursesw5-dev -y

script_dir=$(dirname $(realpath $0))
source "${script_dir}/check-toolchain"
source "${script_dir}/config"

echo -e "\033[42m\t\tStart build kernel\033[0m"
echo "linux: ${busybox}"
echo "arch: ${arch}"
echo "cross compile: ${cross_compile}"

cd $busybox
make ARCH=$arch CROSS_COMPILE=$cross_compile menuconfig
make ARCH=$arch CROSS_COMPILE=$cross_compile -j $cpu_core
make ARCH=$arch CROSS_COMPILE=$cross_compile install

echo "busy file info:"
file _install/bin/busybox